﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using Sinacor.Infra.Service.Security.Services;
using Sinacor.Servico.Bovespa.Titulo.Service.ServiceContract;

namespace Sinacor.Servico.Bovespa.Titulo.Service.ServiceImplementation
{
    /// <summary>
    /// Contrato de servico ITitulo
    /// </summary>
    [SinacorServiceBehavior]
    public class Mercado : IMercado
    {
         #region Campos

        private BusinessLogic.Mercado _mercado;

        #endregion

        #region Construtor
        public Mercado()
        {
            _mercado = new BusinessLogic.Mercado();
        }
        #endregion

        #region [PUB] ConsultarMercados
        public List<DataContract.Response.MercadoResponse> ConsultarMercados(DataContract.Request.FiltroMercadoRequest request)
        {
            Translator.DataContractToBusinessEntity.Mercado translatedatacontract = new Translator.DataContractToBusinessEntity.Mercado();
            Translator.BusinessEntityToDataContract.Mercado translatebusinessentity = new Translator.BusinessEntityToDataContract.Mercado();

            BusinessEntity.Parameter.FiltroMercado filtromercado = translatedatacontract.ToFiltroMercado(request);

            List<BusinessEntity.Mercado> listmercadobusinessentity = _mercado.ConsultarMercados(filtromercado);

            List<DataContract.Response.MercadoResponse> mercadoresponse = translatebusinessentity.ToMercadoResponse(listmercadobusinessentity);

            return mercadoresponse;

        }
        #endregion
    }
}
